<template>
  <div>
    <router-view></router-view>
  <el-table :data="tableData" height="250" border style="width: 100%">
    <el-table-column prop="date" label="姓名" width="180"></el-table-column>
    <el-table-column prop="name" label="身份证号" width="180"></el-table-column>
    <el-table-column prop="shouji" label="联系方式" width="180"></el-table-column>
    <el-table-column prop="address" label="店铺名称"></el-table-column>
  </el-table>
  </div>
</template>
<script>
  export default {
    name:'Formdata',
    data() {
      return {
        tableData: [
            {
          date:'',
          name:'',
          shouji:'',
          address:''
        }
        ]
      }
    },
    methods:{

    },
    activated() {
      let  shuju=this.$route.query.dataforms
      let flag
      for(let i of this.tableData)
      {
        if(shuju[0]!=i.date)
        {
          flag=true
        }
        else {
          flag=false
        }
      }
      if(flag){
        this.tableData.push({
          date: shuju[0],
          name: shuju[1],
          shouji:shuju[2],
          address: shuju[3]
        })
      }else
      {
        this.$message.error('该用户已经被创建')
      }
    },
    beforeRouteLeave(to,from,next){
      console.log(to+'to');
      console.log(from+'from');
      next()
    }

  }
</script>